package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.clqteam.dao.showShNameDao;
import com.clqteam.model.Supplier;
import com.clqteam.util.JDBCutil;

public class showShNameDaoImpl implements showShNameDao{

	
		@Override
		public List<Supplier> getrNameByEmployee() {
			 List<Supplier> role=new ArrayList<Supplier>();
				StringBuffer sql = new StringBuffer();
				sql.append(" SELECT * FROM s_supplier");
				Connection con=JDBCutil.getConnection();
				try {
					 PreparedStatement pst=con.prepareStatement(sql.toString());
					 ResultSet rs=pst.executeQuery();
					 while(rs.next()){
						 Supplier r=new Supplier();
						 r.setSupId(rs.getInt("supId"));
						 r.setSupName(rs.getString("supName"));
						 r.setSupContacts(rs.getString("supContacts"));
						 r.setSupPhone(rs.getString("supPhone"));
						 r.seteId(rs.getInt("eId"));
						role.add(r);
					 }
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
				return role;
		}
	}

